package com.hhf.rpc.examplespringbootconsumer;

import com.hhf.rpc.common.model.entity.User;
import com.hhf.rpc.feirpcspringbootstarter.annotation.RpcReference;
import com.hhf.rpc.common.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @Author hhf
 * @Date 2024/10/20
 * @Description
 */
@Slf4j
@Service
public class ExampleServiceImpl {

    @RpcReference
    private UserService userService;

    public void test(){

        //调用
        User user = new User("hhf", "留取丹心照汗青");
        String result = userService.sayHello(user);
        //结果
        if (result != null){
            log.info("调用成功,结果:{{}}",result);
        }else {
            log.warn("mock模式调用成功,结果:{{}}",result);
        }
    }
}
